<?php

namespace catchAdmin\pc\controller;

use catcher\base\CatchRequest as Request;
use catcher\CatchResponse;
use catcher\base\CatchController;
use catchAdmin\pc\model\WechatUser as WechatUserModel;
use think\Response;

class WechatUser extends CatchController
{

    protected $wechatUserModel;


    /**
     *
     * @time 2025/08/01 16:12
     * @param WechatUserModel $wechatUserModel
     * @return mixed
     */
    public function __construct(WechatUserModel $wechatUserModel)
    {
        $this->wechatUserModel = $wechatUserModel;
    }


    /**
     *
     * @time 2025/08/01 16:12
     * @return Response
     */
    public function index(): Response
    {
        return CatchResponse::paginate($this->wechatUserModel->getList());
    }


    public function getInfo(Request $request): Response
    {
        return CatchResponse::success($this->wechatUserModel->getInfo($request->post()));
    }


    /**
     *
     * @time 2025/08/01 16:12
     * @param Request $request
     * @return Response
     */
    public function save(Request $request): Response
    {
        return CatchResponse::success($this->wechatUserModel->storeBy($request->post()));
    }


    /**
     *
     * @time 2025/08/01 16:12
     * @param $id
     * @return Response
     */
    public function read(Request $request): Response
    {
        return CatchResponse::success($this->wechatUserModel->readData($request->param()));
    }


    /**
     *
     * @time 2025/08/01 16:12
     * @param $id
     * @param Request $request
     * @return Response
     */
    public function update($id, Request $request): Response
    {
        return CatchResponse::success($this->wechatUserModel->updateBy($id, $request->post()));
    }


    /**
     *
     * @time 2025/08/01 16:12
     * @param $id
     * @return Response
     */
    public function delete($id): Response
    {
        return CatchResponse::success($this->wechatUserModel->deleteBy($id));
    }
}
